from rest_framework import serializers

from home import models
from home.models import NavModel, BannerModel, CategoryModel


class NavSer(serializers.ModelSerializer):
    class Meta:
        model = NavModel
        fields = '__all__'
class BannerSer(serializers.ModelSerializer):
    class Meta:
        model = BannerModel
        fields = '__all__'
class Category(serializers.ModelSerializer):
    class Meta:
        model = models.CategoryModel
        fields = ["id","catename"]

#首页分类序列化
class CategorySer(serializers.ModelSerializer):
    children=Category(many=True)
    class Meta:
        model = models.CategoryModel
        fields = "__all__"
class infoSer(serializers.ModelSerializer):
    class Meta:
        model = CategoryModel
        fields = "__all__"